package com.example.module_patrol.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.launcher.ARouter
import com.example.module_patrol.R
import com.example.module_patrol.model.PatrolEntity
import com.example.module_patrol.model.PatrolNotDoingEntity
import com.google.gson.Gson


class NotDoingDetailAdapter :RecyclerView.Adapter<NotDoingDetailAdapter.NotDoingDetailViewHolder>() {
    var pakingList: ArrayList<PatrolEntity> = arrayListOf()

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NotDoingDetailViewHolder {
        return NotDoingDetailViewHolder(
            LayoutInflater.from(parent.context).inflate(R.layout.item_not_detail, parent, false)
        )
    }

    override fun getItemCount(): Int {
        return pakingList.size
    }

    fun addParkingList(list: List<PatrolEntity>) {
        pakingList.clear()
        pakingList.addAll(list)
        notifyDataSetChanged()
    }
    fun addPatrol(entity:PatrolEntity) {
        pakingList.add(entity)
        notifyDataSetChanged()
    }

    override fun onBindViewHolder(holder: NotDoingDetailViewHolder, position: Int) {
        holder.name.text = pakingList[position].pointName
        holder.location.text = pakingList[position].pointLocation
        }


   inner class NotDoingDetailViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
        val name: TextView = itemView.findViewById(R.id.name)
        val location: TextView = itemView.findViewById(R.id.location)

    }

    }













